import axios from 'axios'
const token = localStorage.getItem('token')
axios.defaults.headers.common['authorization'] = "Bearer " +token
var baseURL = 'http://60.205.188.207:8010';


export const GET=(url,params)=>{
    return axios.get(`${baseURL}${url}`,params).then((data)=>{return data})
}

export const HEADGET=(url,params)=>{
    return axios.get(`${baseURL}${url}`,{params:params}).then(data=>data)
}


export const POST=(url,params)=>{
    return axios.post(`${baseURL}${url}`,params).then((data)=>data)
}

export const HEADPOST=(url,params)=>{
    return axios.post(`${baseURL}${url}`,params,{
        headers:{
            authorization:'Bearer '+ token
        }
    }).then((data)=>data)
}

export const PUT=(url,params)=>{
    return axios.put(`${baseURL}${url}`,params,{
        headers:{
            authorization:'Bearer '+ token
        }
    }).then((data)=>data)
}

export const DELETE=(url,params)=>{
    return axios.delete(`${baseURL}${url}${params}`,{
        headers:{
            authorization:'Bearer '+ token
        }
    }).then((data)=>data)
} 